package com.ruoyi.stock2.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.stock2.domain.SEQ2SEQLOG;
import com.ruoyi.stock2.service.ISEQ2SEQLOGService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 深度学习时序模型生成记录Controller
 * 
 * @author ruoyi
 * @date 2020-04-13
 */
@Controller
@RequestMapping("/stock2/SEQ2SEQLOG")
public class SEQ2SEQLOGController extends BaseController
{
    private String prefix = "stock2/SEQ2SEQLOG";

    @Autowired
    private ISEQ2SEQLOGService sEQ2SEQLOGService;

    @RequiresPermissions("stock2:SEQ2SEQLOG:view")
    @GetMapping()
    public String SEQ2SEQLOG()
    {
        return prefix + "/SEQ2SEQLOG";
    }

    /**
     * 查询深度学习时序模型生成记录列表
     */
    @RequiresPermissions("stock2:SEQ2SEQLOG:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SEQ2SEQLOG sEQ2SEQLOG)
    {
        startPage();
        List<SEQ2SEQLOG> list = sEQ2SEQLOGService.selectSEQ2SEQLOGList(sEQ2SEQLOG);
        return getDataTable(list);
    }

    /**
     * 导出深度学习时序模型生成记录列表
     */
    @RequiresPermissions("stock2:SEQ2SEQLOG:export")
    @Log(title = "深度学习时序模型生成记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(SEQ2SEQLOG sEQ2SEQLOG)
    {
        List<SEQ2SEQLOG> list = sEQ2SEQLOGService.selectSEQ2SEQLOGList(sEQ2SEQLOG);
        ExcelUtil<SEQ2SEQLOG> util = new ExcelUtil<SEQ2SEQLOG>(SEQ2SEQLOG.class);
        return util.exportExcel(list, "SEQ2SEQLOG");
    }

    /**
     * 新增深度学习时序模型生成记录
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存深度学习时序模型生成记录
     */
    @RequiresPermissions("stock2:SEQ2SEQLOG:add")
    @Log(title = "深度学习时序模型生成记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(SEQ2SEQLOG sEQ2SEQLOG)
    {
        return toAjax(sEQ2SEQLOGService.insertSEQ2SEQLOG(sEQ2SEQLOG));
    }

    /**
     * 修改深度学习时序模型生成记录
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        SEQ2SEQLOG sEQ2SEQLOG = sEQ2SEQLOGService.selectSEQ2SEQLOGById(id);
        mmap.put("sEQ2SEQLOG", sEQ2SEQLOG);
        return prefix + "/edit";
    }

    /**
     * 修改保存深度学习时序模型生成记录
     */
    @RequiresPermissions("stock2:SEQ2SEQLOG:edit")
    @Log(title = "深度学习时序模型生成记录", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(SEQ2SEQLOG sEQ2SEQLOG)
    {
        return toAjax(sEQ2SEQLOGService.updateSEQ2SEQLOG(sEQ2SEQLOG));
    }

    /**
     * 删除深度学习时序模型生成记录
     */
    @RequiresPermissions("stock2:SEQ2SEQLOG:remove")
    @Log(title = "深度学习时序模型生成记录", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(sEQ2SEQLOGService.deleteSEQ2SEQLOGByIds(ids));
    }

    @PostMapping( "/createSEQ2SEQTrain")
    @ResponseBody
    public AjaxResult createSEQ2SEQTrain(SEQ2SEQLOG sEQ2SEQLOG)
    {
        return toAjax(sEQ2SEQLOGService.createSEQ2SEQTrain(sEQ2SEQLOG));
    }

    @PostMapping( "/createSEQ2SEQModel")
    @ResponseBody
    public AjaxResult createSEQ2SEQModel(SEQ2SEQLOG sEQ2SEQLOG)
    {
        return toAjax(sEQ2SEQLOGService.createSEQ2SEQModel(sEQ2SEQLOG));
    }

    @PostMapping( "/predSEQ2SEQ")
    @ResponseBody
    public AjaxResult predSEQ2SEQ(String symbol)
    {
        return toAjax(sEQ2SEQLOGService.predSEQ2SEQ(symbol));
    }


}
